<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="com.c0nflict.server.*, com.mysql.jdbc.Statement, com.mysql.jdbc.ResultSet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="admin_header.jspf" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>c0nflict: News</title>
</head>
<body>
<%
Database db = tm.db;

if (db == null)
	out.println("Unable to connect to database!");
else {
	Statement stmt = (Statement)db.getConnection().createStatement();	
	String query = "select * from dq_news order by id";
	ResultSet rs = (ResultSet)stmt.executeQuery(query);
	
	rs.last();
	
	int recordCount = rs.getRow();
	
	rs.beforeFirst();
%>
<center><h3 style="color: #ccc;"><b><%= tm.WATCHDOG.toString() %></b></h3></center>

<center><font size="5" color="white" face="verdana"><b><a name="players">News</a></b></font></center>

<div class="dbdataContainer">
<font size="2" color="white" face="verdana"><%= recordCount %> records found:</font>
<table class="sortable" cellpadding="4" cellspacing="0">
<thead>
<tr>
	<th>Id</th>
	<th>Created</th>
	<th>Last Modified</th>
	<th>News</th>
</tr>
</thead>
<tfoot>
<tr><td colspan="0">News in database as of <%= tm.WATCHDOG.toString() %></td></tr>
</tfoot>
<tbody>
	<% while (rs.next()) { %>
<tr <% if (rs.getRow() % 2 == 1) { %> bgcolor="#222" <% } %>>
	<td><%= rs.getInt("id") %></td>
	<td><%= rs.getString("create_date") %></td>
	<td><%= rs.getString("modify_date") %></td>
	<td style="text-align: left;"><%= rs.getString("news") %></td>
</tr>
	<% } %>
</tbody>
</table>
</div>
<% } %>
<%@ include file="admin_footer.jspf" %>
</body>
</html>